﻿
using GCC.APIContainer.Auth;
using GCC.APIContainer.Auth.Filter;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// 认证功能扩展
    /// </summary>
    public static class AuthIServiceCollectionExtends
    {
        /// <summary>
        /// 启用容器认证系统
        /// </summary>
        /// <param name="builder">service builder</param>
        /// <param name="getOpt">返回控制功能</param>
        /// <returns></returns>
        public static IServiceCollection UseGCCAuth(this IServiceCollection builder, Func<IServiceCollection, AuthSettingsInfo> getOpt)
        {
            GCCAuthFilter.AuthConfig = getOpt(builder);
            return builder;
        }
    }
}
